Create function [dbo].[#SRCNAME#_getMinDeweyOrder](@DeweyOrder as bigint,@RValue as bigint,@DocId as int)
Returns bigint as 
BEGIN
	Declare @MDeweyOrder as bigint
	BEGIN
		SELECT @MDeweyOrder=Min(V1.DeweyOrderSum) FROM #SRCNAME#_PathValue as V1 WHERE 	ABS(@DeweyOrder-V1.DeweyOrderSum) < @RValue
				AND V1.DocId = @DocId
	END
	Return @MDeweyOrder
END ;